/*****************************************************************************************
 * FILE NAME: drv_adc                       COPYRIGHT (c) cos 2024
 * REVISION:  1.0.0                                     All Rights Reserved
 * DESCRIPTION:
 * =======================================================================================
 * UPDATE HISTORY:
 * REV      AUTHOR      DATE
 * v1.0.0   Tuxin       2024.10.14
 * DESCRIPTION OF CHANGE:
 ****************************************************************************************/
#ifndef __DRV_ADC_H
#define __DRV_ADC_H

//----------------------------------------------------------------------------------------
// @Project Includes
#include "typedefs.h"

//----------------------------------------------------------------------------------------
// @Global Macro Define in the module
#define ADC_PACKVOL_PIN              (GPIO_PIN_1)
#define ADC_PACKVOL_PORT             (GPIOA)
#define ADC_PACKVOL_GPIO_CLK     		(RCC_APB2_PERIPH_GPIOA)
#define ADC_PACKVOL_CTRL_CH    			(ADC_CH_2_PA1)

#define ADC_CHANNEL_COUNT       	(1u)
#define VBAT_RAW_COUNT    				(10u)

//----------------------------------------------------------------------------------------
// @Global Type defines in the module
typedef enum en_adc1_sample
{
    ADC_PACKVOL  = 0,
    ADC_CHANNEL_TOTAL,
}en_adc_sample_t;

typedef struct stc_pack_parameter
{
    uint8_t  Init_Flag;     /* Pack temperature init flag */
	  uint8_t  Index;
    uint16_t Pack_Avg;
    uint16_t Fifo[VBAT_RAW_COUNT];

} stc_pack_parameter_t;

extern stc_pack_parameter_t  s_stcpackParm;

//----------------------------------------------------------------------------------------
// @Export global Variables declare in the module

//----------------------------------------------------------------------------------------
// @Export declaration of functions in the module
uint16_t drv_adc_getNtcR(en_adc_sample_t ntcType);
uint32_t drv_adc_getPackVol(en_adc_sample_t ntcType);
void drv_adc_dataRefresh(void);
void drv_adc_sleep(void);
void drv_adc_wakeup(void);
void drv_adc_init(void);

#endif

// =======================================================================================
// End of file.
// =======================================================================================
